#ifndef INSTANCE_BACKLOG_FAMILY_H
#define INSTANCE_BACKLOG_FAMILY_H

/*	CLASS:		InstanceBacklogFamily
	AUTHOR:		Marcelo Y. B. Hossomi

	Contains instance specific data with backlogging.
*/

#include "Instance.h"
#include "Input.h"

class InstanceBacklogFamily: public Instance {
private:

	int			F;					// Number of families
	double		*capacityCost;		// J x M
	double		*upperBound;		// J x T
	double		*backlogCost;		// J x T
	double		*totalCapacity;		// M x T
	double		*demand;			// J x T
	double		*holdingCost;		// J
	double		*resourceCost;		// J x T
	double		*setupTime;			// M x F

	int			*family;			// J (family to which product j belongs)
	int			*endProducts;		// Je (index of end products
	int			**successor;		// J x ? (list of successors of product j)
	int			*successorCount;	// J (number of successors of product j)

public:
	
	static const char	*SUBDIR;

	// Initializes all fields.
	InstanceBacklogFamily();

	// Cleans all allocated memory.
	~InstanceBacklogFamily();

	// Loads an instance.
	bool load( const char *name );

	// Returns the instance full path.
	char* getPath( const char *name );

	// Returns the solution size.
	int getSolutionSize();
	int getSolutionRows();

	// Prints this instance data.
	void print();

	// Returns instance data.
	int getFamilyCount();
	double getCapacityCost( int m, int j );
	double getUpperBound( int j, int t );
	double getBacklogCost( int j, int t );
	double getTotalCapacity( int m, int t );
	double getDemand( int j, int t );
	double getHoldingCost( int j );
	double getResourceCost( int j, int k );
	double getSetupTime( int m, int f );
	int getFamily( int j );
	int getEndProduct( int i );
	int getSuccessor( int j, int i );
	int getSuccessorCount( int j );
};

#endif